package gdut.imis.controller;

import gdut.imis.Utils.Result;
import gdut.imis.domain.FileWritePermission;
import gdut.imis.service.FileWritePermissionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @Description
 * @Author JiaFu
 * @Date 2023/4/7 22:18
 */
@RestController
@RequestMapping("/file-write-permission")
@Api(value = "档案录入权限接口", tags = {"档案录入权限接口"})
@RequiredArgsConstructor
public class FileWritePermissionController extends BaseController {
    private final FileWritePermissionService fileWritePermissionService;

    @ApiOperation("新增档案录入权限")
    @PostMapping("/add")
    public Result add(@RequestBody FileWritePermission fileWritePermission) {
        fileWritePermissionService.save(fileWritePermission);
        return success();
    }

    @ApiOperation("普通用户获取档案录入权限列表")
    @GetMapping("/getFileWritePermissions")
    public Result get() {
        return fileWritePermissionService.getFileWritePermissions();
    }
}
